package com.example.matriculagaleraufba;



import java.io.BufferedReader;
import helpers.Json;
import helpers.Json.ReadJSONFeedTask;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.Socket;
import java.net.UnknownHostException;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;

import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.HttpVersion;
import org.apache.http.StatusLine;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.scheme.PlainSocketFactory;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpConnectionParams;
import org.apache.http.params.HttpParams;
import org.apache.http.params.HttpProtocolParams;
import org.json.JSONArray;
import org.json.JSONObject;

import models.Curso;
import helpers.Database;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ListView;
import android.widget.Toast;
import android.app.Activity;
import android.app.FragmentTransaction;
import android.content.Intent;

public class MainActivity extends Activity {

	
	public JSONArray jsonArray;

	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.tela_inicial);

		
		
		/*Database.initialize(openOrCreateDatabase("matriculaufba", Activity.MODE_PRIVATE, null));
		try {
			Curso.create();
			Log.i("curso", "criado");
		} catch (Exception e) {	
			Log.i("curso", "Catch");
		}*/
		
	
		
		
		final Button btUsuario = (Button) findViewById(R.id.btUsuario);
        btUsuario.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                // Perform action on click
            	mostraSessaoActivity();
            	/*Json jsonCurso = new Json();
    			jsonCurso.new ReadJSONFeedTask().execute("https://api.ufba.br/api/v0/cursos"); 
    			*/
            	
            }
        });
        
        
		
        
    
    }
	
	public void mostraSessaoActivity(){
		Intent myIntent = new Intent(MainActivity.this, sessaoActivity.class);

    	String value = null;
		myIntent.putExtra("key", value);

    	MainActivity.this.startActivity(myIntent);
		
	}
	
	/*//lendo json Cursos
	public void downloadJson(View view){
		Log.i("btDownload", "downloadJson");
		
		
		Json jsonCurso = new Json(MainActivity.this);
    	jsonCurso.new ReadJSONFeedTask().execute("https://api.ufba.br/api/v0/cursos"); 
				
		Log.i("executeReadJson", "final");

	}*/
	

	


}
	

